package com.longcai.piaojia.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2017/1/10.
 */
@HttpInlet(Conn.ACTIVITY_VIEW)
public class LatestDetailGet extends BaseAsyGet<LatestDetailGet.LatestDetailEntity> {

    public String id;

    public LatestDetailGet(AsyCallBack<LatestDetailEntity> asyCallBack) {
        super(asyCallBack);
    }

    @Override
    protected LatestDetailEntity parser(JSONObject object) throws Exception {

        TOAST = object.optString("message");


        if (object.optInt("code") == 200) {

            JSONObject mainObject = object.optJSONObject("data");

            LatestDetailEntity entity = new LatestDetailEntity();

            entity.id = mainObject.optString("id");
            entity.picarr = Conn.IMAGE_BANNER_URL + mainObject.optString("picarr");
            entity.starttime = mainObject.optString("starttime");
            entity.endtime = mainObject.optString("endtime");
            entity.address = mainObject.optString("address");
            entity.mobile = mainObject.optString("mobile");
            entity.startweek = mainObject.optString("startweek");
            entity.endweek = mainObject.optString("endweek");

            return entity;
        }


        return null;
    }

    //    "id": 1,
//            "picarr": "uploads/image/20170109/2b19022c7cdaed2698e70ebbdba59104.jpg",  //图片
//            "starttime": "17.01.10", //开始时间
//            "endtime": "17.01.30",  //结束时间
//            "address": "测试哈尔滨4", //地址
//            "mobile": "188451196424", //电话
//            "startweek": "周二", //开始时间
//            "endweek": "周一"   //结束时间
    public static class LatestDetailEntity {

        public String id, picarr, starttime, endtime, address, mobile, startweek, endweek;

    }

}
